﻿using System;
using System.Collections.Generic;
using System.Text;

namespace designmodule.structuralmodule.Flyweight
{
    class program
    {
        void main()
        {
            //主要当一个应用程序有大量的flyweight，不需要每次都去创建new，应该有一个工厂，直接获取
            //这样减轻了存储开销，大多数对象的状态是外部给的
            int extriansicstate = 22;

            var f=new FlyweightFactory();

            var fx = f.GetFlyweight("X");
            fx.operation(--extriansicstate);

            fx = f.GetFlyweight("Y");
            fx.operation(--extriansicstate);

            fx = f.GetFlyweight("Z");
            fx.operation(--extriansicstate);

            var ufx = new UnShareConcreteFlyweight();
            ufx.operation(--extriansicstate);


        }
    }
}
